using UnityEngine;

public class ScrollLayer : MonoBehaviour
{
	private RectTransform rectTransform;

	public RectTransform scrollContent;

	private void Awake()
	{
		rectTransform = GetComponent<RectTransform>();
	}

	private void Start()
	{
		ScrollRectController.ScrollMovedEvent += OnScrollMove;
	}

	private void OnDestroy()
	{
		ScrollRectController.ScrollMovedEvent -= OnScrollMove;
	}

	private void OnScrollMove()
	{
		rectTransform.sizeDelta = scrollContent.sizeDelta;
		rectTransform.localPosition = scrollContent.localPosition;
	}
}
